import request from '@/utils/request.js'

/**
 * 拿到组织结构
 */
export function getDepartmentsList() {
  return request({
    url: '/company/department'
  })
}

/**
 *  删除部门
 * @param {*} id 部门id
 */
export function removeDepartments(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 *  删除部门
 * @param {Object} data {code等}
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 根据id查询部门详情
 * @param {*} id 部门id
 */
export function getDepartmentsById(id) {
  return request({
    url: '/company/department/' + id
  })
}

/**
 * 根据部门id修改部门详情
 * @param {*} data 修改部门参数
 */
export function editDepartmentsById(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
